﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HL.Core.Models;
using HL.Lib.CPControllers;
using HL.Lib.MVC;

namespace HL.Lib.Models
{
    public class MMapCityModel : DefaultModel
    {

        [DataInfo]
        public int ID { get; set; }

        [DataInfo]

        public String CityName { get; set; }

        [DataInfo]
        public int DeleteFlag { get; set; }

        [DataInfo]
        public String X { get; set; }

        [DataInfo]
        public String Y { get; set; }

        [DataInfo]
        public int ZOrder { get; set; }

        
    }

    public class MMapCityEntity : EntityBase
    {
        

        [DataInfo]
        public override int ID { get; set; }

        [DataInfo]
        public String CityName { get; set; }

       
        [DataInfo]
        public int DeleteFlag { get; set; }

        [DataInfo]
        public String X { get; set; }

        [DataInfo]
        public String Y { get; set; }

        [DataInfo]
        public int ZOrder { get; set; }
    }

    public class MMapCityService : ServiceBase<MMapCityEntity>
    {
        #region Autogen by HL

        public MMapCityService()
            : base("[MAP_CITY]")
        {
        }

        private static MMapCityService _Instance = null;

        public static MMapCityService Instance
        {
            get
            {
                if (_Instance == null)
                    _Instance = new MMapCityService();

                return _Instance;
            }
        }

        public List<MMapCityEntity> GetCityList()
        {
            return
                base.CreateQuery().Where(a => a.DeleteFlag == 0).ToList();
        }

        public MMapCityEntity GetByID(int Id)
        {
            return base.CreateQuery().Where(c => c.ID == Id).ToSingle();
        }

        #endregion
    }
}
